/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"98D672C4-60BD-4EEA-81C1-DE8DB306509A",variableType:4}
 */
var fNroIb = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"B196B770-E551-45C8-9510-8EEC2447FCDD",variableType:93}
 */
var fFechaDesde = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"534B7231-83BB-479C-906D-5283EC026B73",variableType:93}
 */
var fFechaHasta = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"8C1FB6BD-A54A-4AE9-A558-1B47E03335F3",variableType:4}
 */
var fNroGan = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"E640BE86-F6D3-43AF-91D7-B84AE372D70C",variableType:4}
 */
var fNroIva = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"4A4A03A8-4A77-4BEE-BEDF-6B6A18217800",variableType:4}
 */
var fProveedor;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"C870932B-DE92-463B-8B82-C15D2213031E"}
 */
function iraDetalle(event) {
	globals.mostrarForm('reten_certificados_dtl')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"F3F85B2D-DD1F-4C66-B2B9-0E6F9D074129"}
 * @AllowToRunInFind
 */
function todos(event) {
	controller.loadAllRecords()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"49D1C1DF-377F-493D-B50A-FCE08A550CA6"}
 * @AllowToRunInFind
 */
function buscar(event) {
	
	if (((fFechaDesde != null) && (fFechaHasta == null)) || ((fFechaDesde == null) && (fFechaHasta != null)))
	{
		globals.DIALOGS.showWarningDialog('Aviso','Por favor, elija ambas fechas','OK')
	}
	else
	{
		controller.find()
		
		if(fFechaDesde != null)
		{
			var Searchdate = new Date()
			Searchdate = utils.dateFormat(fFechaDesde,'dd-MM-yyyy')+'...'+utils.dateFormat(fFechaHasta,'dd-MM-yyyy')
			fecha = '#'+Searchdate +'|dd-MM-yyyy'
		}
		if (fProveedor != null)
			proveedor_id = fProveedor
		if (fNroGan != null)
			gan_nro = fNroGan
		if (fNroIva != null)
			iva_nro = fNroIva
		if (fNroIb != null)
			ib_nro = fNroIb
			
		if (controller.search() == 0)
			globals.DIALOGS.showWarningDialog('Aviso','No se encontraron registros con esos criterios','OK')
	}
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"DB49E1AB-6140-47AF-92C8-51D14A8E66D3"}
 */
function onShow(firstShow, event) {
	if (firstShow)
	{
		fFechaHasta = application.getServerTimeStamp()
		fFechaDesde = new Date (fFechaHasta.getFullYear(),fFechaHasta.getMonth()-1,fFechaHasta.getDate())
	}
	fProveedor = null
}
